.. _`Polynomial Features`: .. _`org.sysess.sympathy.machinelearning.polynomial_features`: Polynomial Features ``````````````````` .. image:: polynomial.svg :width: 48 Generate a new feature matrix consisting of all polynomial combinations of the features with less than a given degree Documentation ::::::::::::: Attributes ========== **n_input_features_** **n_output_features_** **powers_** Definition :::::::::: Output ports ============ **model** model Model Configuration ============= **Degree** (degree) If a single int is given, it specifies the maximal degree of the polynomial features. If a tuple `(min_degree, max_degree)` is passed, then `min_degree` is the minimum and `max_degree` is the maximum polynomial degree of the generated features. Note that `min_degree=0` and `min_degree=1` are equivalent as outputting the degree zero term is determined by `include_bias`. **Include bias** (include_bias) If `True` (default), then include a bias column, the feature in which all polynomial powers are zero (i.e. a column of ones - acts as an intercept term in a linear model). **Only interaction features produced** (interaction_only) If `True`, only interaction features are produced: features that are products of at most `degree` *distinct* input features, i.e. terms with power of 2 or higher of the same input feature are excluded: - included: `x`, `x`, `x * x`, etc. - excluded: `x ** 2`, `x ** 2 * x`, etc. Implementation ============== .. automodule:: node_preprocessing :noindex: .. class:: PolynomialFeatures :noindex: